﻿ @{
    ViewBag.Title = "SysSet";
}
@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <link href="@Url.Content("~/content/css/kingprt.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/bootstrap.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/KingcensSet.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/content/css/font-awesome.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.PrintArea.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/Base/print.js")" type="text/javascript"></script> 
    <link href="~/Scripts/miniui/themes/default/medium-mode.css" rel="stylesheet" type="text/css" />
    <style>
        a:link {
            color:black;
            text-decoration:none;
        }
        a:visited {
            color:black;
            text-decoration:none;
        }
        a:hover {
            color:black;
            text-decoration:underline;
        }
    </style>
}
    <div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;"> 
        <table style="width:100%;">
            <tr>
                <td style="width:100%;">
                    <a class="mini-button" name="saveCorp" iconCls="icon-save" onclick="saveData" plain="true">保存</a>
                     <span class="separator"></span>
                    <a class="mini-button" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
                </td>
            </tr>
        </table>       
    </div>
    <form id="form1" runat="server" method="post" style="height:95%;" borderStyle="border:0;">
        <div id="layout1" class="mini-layout" style="width:100%;height:100%;" borderStyle="border:0;">
            <div region="center" showHeader = "false" >
                <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;height:100%;" plain="false"  borderStyle="border:0;">
                    <div title="会员服务到期提醒">                        
                        <table  style="margin-left:20px;margin-top:20px;">
                            <tr>
                                <td width="80px" height ="35px" align="right"><font color="#FF0000" size ="2">温馨提示：</font></td>
                                <td width="380px" height ="35px">
                                    <font color="#FF0000" size ="2" >每天早上8点到9点自动发送提醒短信。</font>
                                </td>
                                <td width="50px">&nbsp;</td>
                                <td width="380px" style="vertical-align:top;">
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">是否提醒：</td>
                                <td width="380px" height ="35px">
                                    <input id="FMemberIsRemind" name="FMemberIsRemind" class="mini-combobox" style="width:345px;" showNullItem="false"
                                    allowInput="false" align="left" value ="0" data ="dMemberIsRemind"/>      
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">发送时间：</td>
                                <td width="380px" height ="35px">
                                    <input id="FRemindSendNode" name="FRemindSendNode" class="mini-combobox" style="width:70px;" showNullItem="false"
                                    allowInput="false" align="left" value ="0" data ="dRemindSendNode"/>   
                                    <input id="FRemindSendTimes" name="FRemindSendTimes" class="mini-spinner " maxlength="10" style="width:260px;" minValue="0"
                                        maxValue="9999999" TabIndex="11" showbutton="false" allowNull="true" changeOnMousewheel="false" format="#" />天
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">发送周期：</td>
                                <td width="380px" height ="35px">
                                    <input id="FRemindSendPeriod" name="FRemindSendPeriod" class="mini-combobox" style="width:345px;" showNullItem="false"
                                    allowInput="false" align="left" value ="0" data ="dRemindSendPeriod"/>      
                                </td>
                            </tr>
                            <tr>
                                <td width="80px"align="right">短信内容：</td>
                                <td width="380px">
                                    <input id="FMemberRemindMsg" name="FMemberRemindMsg" class="mini-textarea" style="width:345px;height:100px" />    
                                </td>
                            </tr>
                            <tr>
                                <td width="80px"align="right"></td>
                                <td width="380px">
                                    <input class="mini-button" text="会员电话" style="width:80px" onclick="setMemberText('{电话号码}')" />  
                                    <input class="mini-button" text="会员姓名" style="width:80px" onclick="setMemberText('{会员姓名}')" />  
                                    <input class="mini-button" text="到期日期" style="width:80px" onclick="setMemberText('{到期日期}')" />  
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div title="会员次卡到期提醒">                        
                        <table  style="margin-left:20px;margin-top:20px;">
                            <tr>
                                <td width="80px" height ="35px" align="right"><font color="#FF0000" size ="2">温馨提示：</font></td>
                                <td width="380px" height ="35px">
                                    <font color="#FF0000" size ="2" >每天早上8点到9点自动发送提醒短信。</font>
                                </td>
                                <td width="50px">&nbsp;</td>
                                <td width="380px" style="vertical-align:top;">
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">是否提醒：</td>
                                <td width="380px" height ="35px">
                                    <input id="FTimeEndIsRemind" name="FTimeEndIsRemind" class="mini-combobox" style="width:345px;" showNullItem="false"
                                    allowInput="false" align="left" value ="0" data ="dMemberIsRemind"/>      
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">发送时间：</td>
                                <td width="420px" height ="35px">
                                    <input id="FTimeEndSendNode" name="FTimeEndSendNode" class="mini-combobox" style="width:70px;" showNullItem="false"
                                    allowInput="false" align="left" value ="0" data ="dRemindSendNode"/>   
                                    <input id="FTimeEndSendTimes" name="FTimeEndSendTimes" class="mini-spinner " maxlength="10" style="width:260px;" minValue="0"
                                        maxValue="9999999" TabIndex="11" showbutton="false" allowNull="true" changeOnMousewheel="false" format="#" />天
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">发送周期：</td>
                                <td width="420px" height ="35px">
                                    <input id="FTimeEndSendPeriod" name="FTimeEndSendPeriod" class="mini-combobox" style="width:345px;" showNullItem="false"
                                    allowInput="false" align="left" value ="0" data ="dRemindSendPeriod"/>      
                                </td>
                            </tr>
                            <tr>
                                <td width="80px"align="right">短信内容：</td>
                                <td width="420px">
                                    <input id="FTimeEndRemindMsg" name="FTimeEndRemindMsg" class="mini-textarea" style="width:420px;height:100px" />    
                                </td>
                            </tr>
                            <tr>
                                <td width="80px"align="right"></td>
                                <td width="420px">
                                    <input class="mini-button" text="会员电话" style="width:80px" onclick="setTimeEndText('{电话号码}')" />  
                                    <input class="mini-button" text="会员姓名" style="width:80px" onclick="setTimeEndText('{会员姓名}')" />  
                                    <input class="mini-button" text="次卡项目" style="width:80px" onclick="setTimeEndText('{次卡项目}')" />  
                                    <input class="mini-button" text="到期日期" style="width:80px" onclick="setTimeEndText('{到期日期}')" />  
                                    <input class="mini-button" text="剩余次数" style="width:80px" onclick="setTimeEndText('{剩余次数}')" />
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div title="次卡剩余次数提醒" >
                        <table  style="margin-left:20px;margin-top:20px;">
                            <tr>
                                <td width="80px" height ="35px" align="right"><font color="#FF0000" size ="2">温馨提示：</font></td>
                                <td width="280px" height ="35px">
                                    <font color="#FF0000" size ="2" >每天早上8点到9点自动发送提醒短信。</font>
                                </td>
                                <td width="50px" rowspan="10">&nbsp;</td>
                                <td width="400px" rowspan="12" style="vertical-align:top;">
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">是否提醒：</td>
                                <td width="380px" height ="35px">
                                    <input id="FTimeIsRemind" name="FTimeIsRemind" class="mini-combobox" style="width:345px;" showNullItem="false"
                                    allowInput="false" align="left" value ="0" data ="dMemberIsRemind"/>      
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">次卡数量：</td>
                                <td width="380px" height ="35px">
                                    <input id="FTimesQtyNode" name="FTimesQtyNode" class="mini-combobox" style="width:70px;" showNullItem="false"
                                    allowInput="false" align="left" enabled="false" value ="0" data ="dTimesQtyNode"/>   
                                    <input id="FTimesQtys" name="FTimesQtys" class="mini-spinner " maxlength="10" style="width:270px;" minValue="0"
                                        maxValue="999999" TabIndex="11" showbutton="false" allowNull="true" changeOnMousewheel="false" format="#" />
                                </td>
                            </tr>
                            <tr>
                                <td width="80px" height ="35px" align="right">发送周期：</td>
                                <td width="380px" height ="35px">
                                    <input id="FTimeSendPeriod" name="FTimeSendPeriod" class="mini-combobox" style="width:345px;" showNullItem="false"
                                    allowInput="false" align="left" enabled="false" value ="1" data ="dTimeSendPeriod"/>      
                                </td>
                            </tr>
                            <tr>
                                <td width="80px"align="right">短信内容：</td>
                                <td width="380px">
                                    <input id="FTimeRemindMsg" name="FTimeRemindMsg" class="mini-textarea" style="width:420px;height:100px" />    
                                </td>
                            </tr>
                            <tr>
                                <td width="80px"align="right"></td>
                                <td width="420px">
                                    <input class="mini-button" text="会员电话" style="width:80px" onclick="setTimeText('{电话号码}')" />  
                                    <input class="mini-button" text="会员姓名" style="width:80px" onclick="setTimeText('{会员姓名}')" />  
                                    <input class="mini-button" text="次卡项目" style="width:80px" onclick="setTimeText('{次卡项目}')" />  
                                    <input class="mini-button" text="到期日期" style="width:80px" onclick="setTimeText('{到期日期}')" />  
                                    <input class="mini-button" text="剩余次数" style="width:80px" onclick="setTimeText('{剩余次数}')" />  
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div title="其它短信提醒设置" >
                        <div title="短信帐户余额预警" class="mini-panel" style="width:100%;height:160px;" buttons="">
                            <table  style="margin-left:20px;margin-top:20px;">
                                <tr>
                                    <td width="80px" height ="35px" align="right">是否提醒：</td>
                                    <td width="380px" height ="35px">
                                        <input id="FMsgIsRemind" name="FMsgIsRemind" class="mini-combobox" style="width:345px;" showNullItem="false"
                                        allowInput="false" align="left" value ="0" data ="dMemberIsRemind"/>      
                                    </td>
                                </tr>
                                <tr>
                                    <td width="80px" height ="35px" align="right">预警手机号：</td>
                                    <td width="380px" height ="35px">
                                        <input name="FMsgRemindPhone" id="FMsgRemindPhone" class="mini-textbox" maxlength="13" style="width:345px;"/>
                                    </td>
                                </tr>
                            </table> 
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
<script>
    var dMemberIsRemind = [{ "id": "0", "text": "不提醒" },
                    { "id": "1", "text": "自动提醒" }];

    var dRemindSendNode = [{ "id": "0", "text": "提前" },
                    { "id": "1", "text": "过后" }];

    var dRemindSendPeriod = [{ "id": "0", "text": "每天连续发送" },
                    { "id": "1", "text": "发送一次" }];

    var dTimesQtyNode = [{ "id": "0", "text": "小于" }];

    var dTimeSendPeriod = [{ "id": "1", "text": "发送一次" },
                    { "id": "3", "text": "每天连续发送，共发送3天" }];

    mini.parse();
    loadData();

    function loadData() {
        $.post("GetMemberRemind", { mSystemAppID: parent.window.getSystemAppID() }, function (data) {
            var form = new mini.Form("form1");
            var mdata = mini.decode(data);
            if (mdata.data.length > 0) {
                form.setData(mdata.data[0]);
            }
        });
    }

    function setMemberText(data) {
        mini.getbyName("FMemberRemindMsg").setValue(mini.getbyName("FMemberRemindMsg").getValue() + data);
    }

    function setTimeEndText(data) {
        mini.getbyName("FTimeEndRemindMsg").setValue(mini.getbyName("FTimeEndRemindMsg").getValue() + data);
    }

    function setTimeText(data) {
        mini.getbyName("FTimeRemindMsg").setValue(mini.getbyName("FTimeRemindMsg").getValue() + data);
    }

    function saveData() {
        var form1 = new mini.Form("#form1");
        var data1 = form1.getData(true, false);
        var json1 = mini.encode(data1);
        $.post("SaveMemberRemind", { json: json1, mSystemAppID: parent.window.getSystemAppID() }, function (data) {
            var ret = mini.decode(data);
            if (ret.status == "1")
                mini.showTips({ content: ret.msg, state: "success", x: "center", y: "top", timeout: 3000 });
            else
                mini.showTips({ content: ret.error, state: "danger", x: "center", y: "top", timeout: 3000 });
        });
    }

</script>